import speech_recognition as sr

# 创建一个语音识别器对象
r = sr.Recognizer()

# 读取音频文件
with sr.AudioFile('audio_file.wav') as source:
    audio = r.record(source)

# 将语音转换为文本
text = r.recognize_google(audio)

# 输出结果
print(text)
